<?php
header("content-type:text/html;charset=utf-8");
session_start();
include("conn/conn.php");
$name=$_POST["name"];
$pass=$_POST["password"];
$yzm1=$_SESSION['string'];

if($name=="" || $pass==""){
	echo("<script>alert('用户名或密码为空');window.location.href='denglu.php';</script>");
	}
	if(strcasecmp($yzm1)==0){
$sql="select * from tb_user where name='".$name."'and password='".$pass."'";
$result=mysqli_query($link,$sql);
if(mysqli_num_rows($result)>0){
	$rows_user=mysqli_fetch_assoc($result);
	$_SESSION['name']=$rows_user[name];
	echo("<script>alert('登录成功');window.location.href='food.php';</script>");
}else{
	echo("<script>alert('打错账号或密码了呀');window.location.href='denglu.php';</script>");
}
	}
?>